package com.wctj.api.business.common.service.setapp;

import com.wctj.api.base.enums.ApiCode;
import com.wctj.api.base.enums.PayChannelEnums;
import com.wctj.api.base.exception.CustomException;
import com.wctj.api.business.common.dto.PayOrderDTO;
import com.wctj.api.business.common.service.AbstractPayChannelService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * 微信小程序
 */
@Service
public class PayChannelWxLiteService implements AbstractPayChannelService {

    @PostConstruct
    public void init() {
        PAY_CHANNEL_MAP.put(PayChannelEnums.ADAPAY_WX_LITE, this);
    }

    @Override
    public void validParam(PayOrderDTO param) {

        if (StringUtils.isBlank(param.getOpenId())){
            throw new CustomException(ApiCode.PAY_CHANNEL_OPEN_ID_NOT_EXIST_FAIL, "openId(微信用户关注商家公众号的openid)不能为空");
        }
    }


}
